<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/5/31
 * Time: 10:01
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\common\business;

use app\common\model\MallCommission;
use app\common\model\MallCommissionR;
use think\Exception;

class BusPartner extends BusBase
{
    /**
     * 查询剩余佣金
     * @param int $cate_id
     * @return int|mixed
     * @throws Exception
     */
    public function getPartnerBySurplus(int $cate_id = 0)
    {
        try {
            $commission = (new MallCommissionR())->getPartnerBySurplus($cate_id);
        } catch (\Exception $e) {
            throw new Exception("查询失败");
        }

        return $commission ?? 0;
    }
}